package com.eagle.demo.service.impl;

import com.eagle.core.annotation.SelfService;
import com.eagle.core.annotation.SelfTransactional;
import com.eagle.demo.bean.UserInfo;
import com.eagle.demo.service.DemoService;

import java.util.ArrayList;
import java.util.List;

@SelfService
public class DemoServiceImpl implements DemoService {
	@Override
	@SelfTransactional
	public UserInfo get(String name) {
		UserInfo userInfo = new UserInfo();
		userInfo.setId(1);
		userInfo.setName(name);
		userInfo.setAge(36);
		return userInfo;
	}

	@Override
	@SelfTransactional
	public List<UserInfo> findAllUser() {
		List<UserInfo> userList = new ArrayList<>();
		UserInfo userInfo1 = new UserInfo();
		userInfo1.setId(1);
		userInfo1.setName("eagle");
		userInfo1.setAge(36);

		UserInfo userInfo2 = new UserInfo();
		userInfo2.setId(2);
		userInfo2.setName("frank");
		userInfo2.setAge(30);


		UserInfo userInfo3 = new UserInfo();
		userInfo3.setId(3);
		userInfo3.setName("winy");
		userInfo3.setAge(32);

		userList.add(userInfo1);
		userList.add(userInfo2);
		userList.add(userInfo3);

		return userList;
	}
}
